<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="wrapper">
        <strong>年会抽奖</strong>
        <h1>一等奖:<span id="one">???</span></h1>
        <h1>二等奖:<span id="tow">???</span></h1>
        <h1>三等奖:<span id="three">???</span></h1>
    </div>
    <script>
        //1.声明数组
        const personArr = ['周杰伦', '刘德华', '周星驰', 'pink老师']
        //2.抽奖 先做一等奖
        //2.1 随机数, 数组下标
        const random = Math.floor(Math.random() * personArr.length)
        //2.2获取one元素
        const one = document.querySelector('#one');
        one.innerHTML=personArr[random];
        personArr.slice(random,1);
        //获取tow元素
        const tow = document.querySelector('#tow');
        tow.innerHTML=personArr[random+1];
        //获取three元素
        const three = document.querySelector('#three');
        three.innerHTML=personArr[random+2];

    </script>
</body>

</html>